#ifndef _DAEMON_H_
#define _DAEMON_H_

#include "service.h"

#define LISTEN_BACKLOG          5


/* description: Start every service in the list starting with the element
 *   pointed by `*head`.
 *   If a service fails to start, remove its entry from the list ( a double
 *   pointer to the head of the list is required for this reason).
 */
void start_services(service_t** head);


/* description: Handle server termination.
 *   This function has to be called only from within the `SIGCHLD` handler.
 */
void handle_server_term(service_t* head);


/* description: Call `select()` and process connection requests.
 *   This is the core function of the superserver.
 */
void serve(service_t* head);


#endif  /* _DAEMON_H_ */